package com.tiancheng.onecode.controller.api;

import com.tiancheng.onecode.model.request.MessageBody;
import com.tiancheng.onecode.model.request.MiniLoginRequest;
import com.tiancheng.onecode.model.response.Result;
import com.tiancheng.onecode.service.ILoginService;
import com.tiancheng.onecode.utils.JsonUtil;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName LoginApiController
 * @Description TODO
 * @Author kellen
 * @Date 2024/12/7 17:23
 */
@Slf4j
@RequestMapping("/api/login")
@RestController
public class LoginApiController {

    @Resource
    private ILoginService loginService;

    @PostMapping("/miniLogin")
    public Result<String> payCallBack(@RequestBody MiniLoginRequest loginRequest) {
        log.info("接收到登录请求：{}", JsonUtil.toJsonString(loginRequest));
        loginService.miniLogin(loginRequest);
        return Result.success("消息回调处理成功！");
    }

}
